//定义用户的数据单元
import { defineStore } from 'pinia'
import { ref,computed } from 'vue'

//声明数据单元
export const useUserStore = defineStore('user', () => {
    //数据
    const user = ref({})
    //获取数据定义成计算属性
    const getUser = computed(() => user.value.user_id)   
    const getUserx = computed(() => user.value)   
    //给数据赋值
    function setUser(u) {
        user.value=u
    }
    return { user, getUser,getUserx, setUser }
})